import { useEventEmitter } from 'ahooks'
import { FormTemplate } from '../../Utils/FormTemp'
import { modifyTableLadorStyle } from '../../Config/tableConfig'

const SetLadorStyle = ({ ModalEvent, data }) => {
    const { key, init } = data
    const FormEvent = useEventEmitter()
    FormEvent.useSubscription(val => {
        const { type, data } = val
        if (type === 'Added') ModalEvent.emit({ type: 'modifyStyle', data: { key, style: data } })

    })
    ModalEvent.useSubscription(val => {
        const { type, data } = val
        if (type === 'offLoading') FormEvent.emit({ type: 'offLoading' })
    })


    return (
        <div className='SetLadorStyle'>
            <FormTemplate columns={modifyTableLadorStyle} init={init} ModalEvent={FormEvent} />
        </div>
    );
};

export default SetLadorStyle;